from django.db import models
from django.contrib.auth.models import AbstractUser

# Create your models here.

class User(AbstractUser):
    ROLE_CHOICES = (
        ('customer', '顾客'),
        ('merchant', '商家'),
        ('admin', '管理员'),
    )
    
    phone = models.CharField(max_length=11, verbose_name='手机号码', blank=True)
    role = models.CharField(max_length=10, choices=ROLE_CHOICES, default='customer', verbose_name='用户角色')
    address = models.TextField(verbose_name='配送地址', blank=True)
    
    class Meta:
        verbose_name = '用户'
        verbose_name_plural = verbose_name
        
    def __str__(self):
        return self.username
